{% extends "rudiment_index.html" %}
{% load staticfiles %}
{% load tz %}
{% load splitT %}
{% block breadcrumb %}资产管理
<span style="margin-left: 50px"></span>
<a class="btn btn-sm  btn-primary "
               href="/cmdb/asset_info"    style="line-height:10px; text-align:center; color: white"> 资产管理 <span class="glyphicon glyphicon-wrench"></span></a>
<span style="margin-left: 1px"></span>
<a class="btn btn-sm  btn-primary "
               href="/cmdb/idc_info"  style="line-height:10px; text-align:center; color: white"> 机房管理 <span class="glyphicon glyphicon-asterisk"></span></a>
<span style="margin-left: 1px"></span>
<a class="btn btn-sm  btn-primary "
               href="/cmdb/group_connect"  style="line-height:10px; text-align:center; color: white"> 属组管理 <span class="glyphicon glyphicon-tags"></span></a>
<!--<a class="btn btn-sm  btn-primary " modal-title="组管理" data-target="#edit" data-toggle="modal" data-height="680" data-width="600"-->
               <!--href="/cmdb/asset_edit?id={{host.id}}"  style="line-height:10px; text-align:center; color: white"> 分组管理 <span class="glyphicon glyphicon-tags"></span></a>-->


{% endblock %}




{% block content %}



    <div class="row">
        <form class="form form-inline" action="/docker/search_build_image" method="POST">
             {% csrf_token %}
            <div class="well well-sm">
                主机名:&nbsp;<input type="text" name="newimage" value="{{ newimage }}" class="form-control  input-sm" size="10" />
                Ip:&nbsp;        <input type="text" name="version" value="{{ version }}" class="form-control  input-sm" size="10" />
                机房:&nbsp;        <select name="asset_type" class="form-control m-b input-sm" onchange="change_info()">
                                    <option value="">-----------</option>
                                    {% for i in all_type %}
                                    <option value="">{{ i }}</option>
                                    {% endfor%}

                                </select>

                设备类型:&nbsp; <select name="asset_type" class="form-control m-b input-sm" onchange="change_info()">
                                    <option value="">-----------</option>
                                    {% for i in all_type %}
                                    <option value="">{{ i }}</option>
                                    {% endfor%}

                                </select>
                设备状态:&nbsp;  <select name="status" class="form-control m-b input-sm" onchange="change_info()">
                                    <option value="">-----------</option>
                                    {% for i in all_status %}
                                    <option value="">{{ i }}</option>
                                    {% endfor%}
                                </select>
                <div class="btn-group">
                    <input type="submit" class="btn btn-primary btn-sm" onclick="showLoading()"  value="搜索"/>
                </div>
            </div>
        </form>
    </div>

   <div class="row">
          <div class="col-sm-2" style="padding-left: 0">
                 <a class="btn   btn-success" modal-title="资产添加" data-target="#add" data-toggle="modal" data-height="680" data-width="600"
               href="/cmdb/asset_add">
                添加资产信息
            </a>
          </div>

          <div id="add" class="modal hide fade " tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
            <div class="modal-header">
                <span class="glyphicon glyphicon-fullscreen"></span>
                <span class="close" data-dismiss="modal" aria-hidden="true"><i class="glyphicon glyphicon-remove "></i></span>

                <h3>对话框标题</h3>
            </div>
            <div class="modal-body" style="overflow:scroll"></div>

        </div>

        <div id="edit" class="modal hide fade " tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
            <div class="modal-header">
                <span class="glyphicon glyphicon-fullscreen"></span>
                <span class="close" data-dismiss="modal" aria-hidden="true"><i class="glyphicon glyphicon-remove "></i></span>

                <h3>对话框标题</h3>
            </div>
            <div class="modal-body" style="overflow:scroll"></div>

        </div>







        <!--<form class="form form-inline" action="" method="post">-->





                <!--<div class="col-sm-5" style="padding-left: 0px">-->
                            <!--<label>-->
                                <!--<select name="idc" class="form-control m-b input-sm" onchange="change_info()">-->
                                    <!--<option value="">机房</option>-->
                                <!--</select>-->
                            <!--</label>-->


                            <!--<label>-->
                                <!--<select name="group" class="form-control m-b input-sm" onchange="change_info()">-->
                                    <!--<option value="">主机组</option>-->

                                <!--</select>-->
                            <!--</label>-->


                            <!--<label>-->
                                <!--<select name="asset_type" class="form-control m-b input-sm" onchange="change_info()">-->
                                    <!--<option value="">设备类型</option>-->
                                    <!--{% for i in all_type %}-->
                                    <!--<option value="">{{ i }}</option>-->
                                    <!--{% endfor%}-->

                                <!--</select>-->
                            <!--</label>-->


                            <!--<label>-->
                                <!--<select name="status" class="form-control m-b input-sm" onchange="change_info()">-->
                                    <!--<option value="">设备状态</option>-->
                                    <!--{% for i in all_status %}-->
                                    <!--<option value="">{{ i }}</option>-->
                                    <!--{% endfor%}-->
                                <!--</select>-->
                            <!--</label>-->

                        <!--</div>-->




                    <!--<div class="col-sm-4" style="padding-right: 0;">-->
                             <!--<div class="input-group inline-group padding-right: 10px">-->
                                <!--<input type="text" class="form-control m-b "  name="keyword" value="{{ keyword }}" placeholder="Search">-->
                                <!--<input type="text" style="display: none">-->
                                <!--<div class="input-group-btn ">-->

                                    <!--<a id='btnSearch' href="/docker/image_delete?imagede={{ item.id }}" style="text-decoration:none;margin-left: 5px" class="btn btn-primary ">-->
                                        <!--<b>&nbsp;搜索&nbsp;</b>-->
                                    <!--</a>-->
                                <!--</div>-->
                            <!--</div>-->
                        <!--</div>-->
        <!--</form>-->
   </div>

                <!-- /.box-header -->

                <div class="box-body" style="margin-top: 10px">
                  <table class="table table-striped table-bordered" id="dataform">
                      <thead>
                        <tr>
                            <th>
                                <input id="checkall" type="checkbox" class="i-checks" name="checkall" value="checkall" data-editable='false' onclick="check_all('asset_form')">
                            </th>
                                    <th>主机名</th>
                                    <th>外网IP</th>
                                    <th>内网IP</th>
                                    <th>CPU</th>
                                    <th>内存(G)</th>
                                    <th>磁盘(G)</th>
                                    <th>状态</th>
                                    <th>类型</th>
                                    <th>机房</th>
                                    <th>属组信息</th>
                                    <!--<th>机房</th>-->

                                    <th class="text-center">功能</th>
                                </tr>
                            </thead>
                            <tbody>


                                    {% for host in assets_infos %}
                                    <tr class="even gradeX">
                                        <td><input type="checkbox" id="id" class="i-checks" value="{{ host.id }}" name="id" /></td>
                                        <!--<td><a href="#"><li style="list-style-type:none" onclick="return detail(this.value)" value="{{ host.hostname }}"> {{ host.hostname }}</li></a></td>-->
                                        <td><a class="" modal-title="资产信息" data-target="#show" data-toggle="modal"
                                                                              data-height="680" data-width="600"
                                                                              href="/cmdb/asset_show?id={{host.id}}"><li style="list-style-type:none"  value="{{ host.hostname }}"> {{ host.hostname }}</li></a></td>
                                                                    <!--<a class="btn btn-sm  btn-primary glyphicon glyphicon-wrench" modal-title="资产编辑" data-target="#edit" data-toggle="modal" data-height="680" data-width="600"-->
               <!--href="/cmdb/asset_edit?id={{host.id}}">-->
<!---->
            <!--</a>-->


                                        <td>{{ host.other_ip}}</td>
                                        <td>{{ host.ip}}</td>
                                        {% if host.cpu_num %}
                                        <td>{{ host.cpu_num}}G</td>
                                        {% else %}
                                        <td>" "</td>
                                        {% endif %}
                                        {% if host.memory %}
                                        <td>{{ host.memory}}G</td>
                                        {% else %}
                                        <td>" "</td>
                                        {% endif %}
                                        <td>{{ host.disk}}</td>
                                        <!--<td>{{ host.vendor}}</td>-->
                                        <td>{{ host.status}}</td>
                                        {% if host.asset_type%}
                                        <td>{{ host.asset_type}}</td>
                                        {% else %}
                                        <td> </td>
                                        {% endif %}
                                        <!--<td>{{ host.idc_id}}</td>-->
                                        {% if host.idc %}
                                        <!--<td><a href="#"> {{ host.idc}}</a></td>-->

                                        <td><a class="" modal-title="机房信息" data-target="#shIDC" data-toggle="modal"
                                                                              data-height="550" data-width="580"
                                                                              href="/cmdb/idc_show?idcn={{host.idc}}"><li style="list-style-type:none"  value="{{ host.idc }}"> {{ host.idc }}</li></a></td>
                                        {% else %}
                                        <td> </td>


                                        {% endif %}
                                         <td><a href="/cmdb/group_connect"> {{ host.id | get_res }}</a></td>
                                        <!--{% if host.idc %}-->
                                        <!--<td>{{ host.idc}}</td>-->
                                        <!--{% else %}-->
                                        <!--<td> </td>-->
                                        <!--{% endif %}-->

                                        <!--<td>{{ host.idc}}</td>-->

                                        <td class="text-center" data-editable='false'>
                                        <!--<a class="btn btn-sm btn-info" target="_blank" href="http://{{ host.hostname }}.{{ webssh_domain }}:2222/ssh/host/{{ host.ip }}" class="btn btn-xs btn-info">WebSSH</a>-->


                                            <!--<a href="#"><li class="btn btn-sm btn-info" onclick="return tanchu(this.value)" value="{{ host.id }}">编辑</li></a>-->
                                             <a class="btn btn-sm  btn-primary glyphicon glyphicon-wrench" modal-title="资产编辑" data-target="#edit" data-toggle="modal" data-height="680" data-width="600"
               href="/cmdb/asset_edit?id={{host.id}}">

            </a>



                                        <a class="btn btn-sm  btn-danger  glyphicon glyphicon-remove asset_del" modal-title="资产删除" data-target="#asset_del" data-toggle="modal" data-height="150" data-width="400"
               href="/cmdb/asset_del?id={{host.id}}">

            </a>
                                        <!--<a value="" class="btn btn-sm btn-danger asset_del">删除</a>-->
                                    </td>
                                    </tr>
                                {% endfor %}


                            </tbody>
                  </table>


        <ul class="pagination" id="pager">
        {% if assets_infos.has_previous %}
            <li class="previous"><a href="/cmdb/asset_info/?page={{ assets_infos.previous_page_number }}">上一页</a></li>
        {% else %}
            <li class="previous disabled"><a href="#">上一页</a></li>
        {% endif %}
        {% for num in paginator.page_range %}
            {% if num == currentPage %}
                <li class="item active"><a href="/cmdb/asset_info/?page={{ num }}">{{ num }}</a></li>
            {% else %}
                <li class="item"><a href="/cmdb/asset_info/?page={{ num }}">{{ num }}</a></li>
            {% endif %}
        {% endfor %}
        {% if assets_infos.has_next %}
            <li class="next"><a href="/cmdb/asset_info/?page={{ assets_infos.next_page_number }}">下一页</a></li>
        {% else %}
            <li class="next disabled"><a href="#">下一页</a></li>
        {% endif %}
    </ul>

      <div id="asset_del" class="modal hide fade " tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
            <div class="modal-header">
                <span class="glyphicon glyphicon-fullscreen"></span>
                <span class="close" data-dismiss="modal" aria-hidden="true"><i class="glyphicon glyphicon-remove "></i></span>

                <h3>对话框标题</h3>
            </div>
            <div class="modal-body"></div>
        </div>


          <div id="show" class="modal hide fade " tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
            <div class="modal-header">
                <span class="glyphicon glyphicon-fullscreen"></span>
                <span class="close" data-dismiss="modal" aria-hidden="true"><i class="glyphicon glyphicon-remove "></i></span>

                <h3>对话框标题</h3>
            </div>
            <div class="modal-body"></div>
        </div>

       <div id="shIDC" class="modal hide fade " tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
            <div class="modal-header">
                <span class="glyphicon glyphicon-fullscreen"></span>
                <span class="close" data-dismiss="modal" aria-hidden="true"><i class="glyphicon glyphicon-remove "></i></span>

                <h3>对话框标题</h3>
            </div>
            <div class="modal-body"></div>
        </div>


{% endblock %}